package com.order.flowserver.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

	private ApiInfo getApiInfo() {

		ApiInfo apiInfo = new ApiInfoBuilder().title("Shi Tou Framework flowserver API")
				.description("Shi Tou Framework flowserver API").contact("author@invstone.com").build();
		return apiInfo;
	}

	@Bean
	public Docket api() {
		return new Docket(DocumentationType.SWAGGER_2).groupName("flowserver").genericModelSubstitutes(DeferredResult.class)
				.useDefaultResponseMessages(false).forCodeGeneration(true).pathMapping("/").select()
				//.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
				.build().apiInfo(getApiInfo());
	}

}
